'''
给你两个有序整数数组 nums1 和 nums2，请你将 nums2 合并到 nums1 中，使 nums1 成为一个有序数组。
'''
class Solution:
    def merge(self, nums1, m: int, nums2, n) :
        """
        Do not return anything, modify nums1 in-place instead.
        """
        nums1[m:] = nums2
        return nums1.sort()
'''
思路就是拼接数组然后排序，附加一个快排
'''
def quickSort(alist):
    flag = 0
    left = []
    right = []
    # 只剩一个数字的时候返回就可以了
    if len(alist) < 2:
        return alist
    else:
        # flag放在中间，小于的放在左边，大于的放在右边
        mid = alist[flag]
        for i in range(1,len(alist)):
            if alist[i] <= alist[flag]:
                left.append(alist[i])
            elif alist[i] > alist[flag]:
                right.append(alist[i])
        return quickSort(left) + [mid] + quickSort(right)


# def quickSort(arr):
#     if len(arr) < 2:
#         return arr
#     else:
#         mid = arr[0]
#         left = [i for i in arr[1:] if i <= mid]
#         right = [i for i in arr[1:] if i > mid]
#         return quickSort(left) + [mid] + quickSort(right)

ilist = quickSort([4, 5, 6, 7, 3, 2, 6, 9, 8, 1, 10])
print(ilist)